package BullsAndCows;

import java.util.Random;
import java.util.Scanner;

public class guessNumber {
    public static void main(String[] args){
        guess();
    }
    public static void guess()
    {
        Random r = new Random();
        int luckNumber = r.nextInt(100) + 1;
        Scanner sc = new Scanner(System.in);
        int num = 0;
        do{
            System.out.println("请输入猜测的数字：");
            num = sc.nextInt();
            if(luckNumber > num)
            {
                System.out.println("猜小了");
            }
            else if(luckNumber < num)
            {
                System.out.println("猜大了");
            }
            else
            {
                System.out.println("恭喜你，猜对了");
            }
        }while(luckNumber != num);
    }
}
